<?php
include ("boot.php");

//$oADODB->debug = true;
// ==========================================================================
// User Class
// ==========================================================================

$oUsers = new users($oADODB);

// ==========================================================================
// Register User
// ==========================================================================

// removes slashes
$sViewdb = stripslashes($_GET['viewdb']);

// decode json recieved from Bindows to Array
$aRequest = json_decode($sViewdb, true);

// check login
$oUsers->addFilter("vUseEmail", "=", $aRequest['vUseEmailLogin']);
$oUsers->addFilter("vUsePassword", "=", $aRequest['vUsePasswordLogin']);

$rs = $oUsers->getAll();

if ($rs->EOF)
{
	$oResponse->AUTH_OK = false;
}
else
{
	$oResponse->AUTH_OK = true;
	$_SESSION['iUseID'] = $rs->fields[$oUsers->PrimaryKey];
	$o = new Menu;
	$oResponse->oMenu = $o->getMenu();
}

// print response
echo json_encode($oResponse);
?>